
#ifndef _ZOOKIT_H_
#define _ZOOKIT_H_

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <list>
#include <zookeeper.h>
#include <zookeeper_log.h>
#include "message_struct.pb.h"

namespace SpiderWebKitClient {

class ZooKit {
    public:
    ZooKit();
    ~ZooKit();

    void connect(std::string host);
    void set(std::string path, std::string content);
    bool get(std::string group, std::string appip, ProcessRouter::ManagerInfoStruct &is, int retry);
    bool getChild(std::string group, std::list<std::string> &childs, int retry);

    private:
    bool retryFeasible(int zkrc);

    zhandle_t* m_handle;
    std::string m_root;
    std::string m_host;
};

}

#endif

